#ifndef Client_h__
#define Client_h__

#include "NonCopyable.h"
#include "Singleton.h"
#include "GameMessage.h"

class Client : public NonCopyable
{
private:
	Client();
	friend class Singleton<Client>;
public:
	bool SendToServer(GameMessage& gm);
    bool RequestIDFromServer();
    bool IsConnected(){return m_connected;}
    void Update();
    void SetID(int id){m_id = id;}
	bool ConnectToServer(const std::string& IP, int port);
    bool Listen();
    void ShutDown();
    int GetID(){return m_id;}
    void HasDisconnected(){m_connected = false;}
    bool PingServer();
    void AcceptPing(float ts);
    void SetTime(float t){m_time = t;}
    bool RequestTimeUpdate();
    
private:
    int m_id;
    Networking::Socket m_sock;
    float m_time;
    float m_delay;
    bool m_connected;
    int m_pingCounter;
    float m_pingStore;
    int m_numPingSent;
    
};

typedef Singleton<Client>  TheClient;
#endif // Client_h__
